package com.swanclouds.redfish.systems.domain;

import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.swanclouds.model.systems.LogEntrie;

import java.util.List;
import java.util.Map;

/**
 * @author 张立强
 * @version jdk1.8.0
 */
public class LogEntrieModel implements LogEntrie {

    @JsonProperty("@odata.id")
    private String dataId;

    @JsonProperty("@odata.context")
    private String context;

    @JsonProperty("@odata.type")
    private String type;

    @JsonProperty("Id")
    private String id;

    @JsonProperty("Name")
    private String name;

    @JsonProperty("Description")
    private String description;

    @JsonProperty("Severity")
    private String severity;

    @JsonProperty("Created")
    private String created;

    @JsonProperty("EventTimestamp")
    private String eventTimestamp;

    @JsonProperty("EntryType")
    private String entryType;

    @JsonProperty("EventId")
    private String eventId;

    @JsonProperty("EventType")
    private String eventType;

    @JsonProperty("Message")
    private String message;

    @JsonProperty("MessageId")
    private String messageId;

    @JsonProperty("MessageArgs")
    private List<String> messageArgs;

    @JsonProperty("Oem")
    private Map<String,Object> oem;

    /**
     * 系统资源的访问路径
     *
     * @return dataId
     */
    @Override
    public String getDataId() {
        return this.dataId;
    }

    /**
     * 系统资源模型的OData描述信息
     *
     * @return context
     */
    @Override
    public String getContext() {
        return this.context;
    }

    /**
     * 系统资源的类型
     *
     * @return type
     */
    @Override
    public String getType() {
        return this.type;
    }

    /**
     * 系统资源的ID
     *
     * @return Id
     */
    @Override
    public String getId() {
        return this.id;
    }

    /**
     * 系统资源的名称
     *
     * @return Name
     */
    @Override
    public String getName() {
        return this.name;
    }
    /**
     * @return 日志资源描述信息
     */
    @Override
    public String getDescription() {
        return this.description;
    }

    /**
     * @return 安全级别 [OK,Warning,Critical]
     */
    @Override
    public String getSeverity() {
        return this.severity;
    }

    /**
     * @return 日志创建时间
     */
    @Override
    public String getCreated() {
        return this.created;
    }

    /**
     * @return 事件发生时间
     */
    @Override
    public String getEventTimestamp() {
        return this.eventTimestamp;
    }

    /**
     * @return 日志类型 [Event,SEL,Oem]
     */
    @Override
    public String getEntryType() {
        return this.entryType;
    }

    /**
     * @return 事件码
     */
    @Override
    public String getEventId() {
        return this.eventId;
    }

    /**
     * @return 事件类型
     */
    @Override
    public String getEventType() {
        return this.eventType;
    }

    /**
     * @return 消息
     */
    @Override
    public String getMessage() {
        return this.message;
    }

    /**
     * @return 消息id
     */
    @Override
    public String getMessageId() {
        return this.messageId;
    }

    /**
     * @return 消息参数
     */
    @Override
    public List<String> getMessageArgs() {
        return this.messageArgs;
    }

    /**
     * @return 自定义属性
     */
    @Override
    public Map<String, Object> getOem() {
        return this.oem;
    }

    @Override
    public String toString() {
        ObjectMapper objectMapper = new ObjectMapper();
        try {
            return objectMapper.writeValueAsString(this);
        } catch (JsonProcessingException e) {
        }
        return "LogEntrieModel {" +
                "dataId='" + dataId + '\'' +
                ", context='" + context + '\'' +
                ", type='" + type + '\'' +
                ", id='" + id + '\'' +
                ", name='" + name + '\'' +
                ", description='" + description + '\'' +
                ", severity='" + severity + '\'' +
                ", created='" + created + '\'' +
                ", eventTimestamp='" + eventTimestamp + '\'' +
                ", entryType='" + entryType + '\'' +
                ", eventId='" + eventId + '\'' +
                ", eventType='" + eventType + '\'' +
                ", message='" + message + '\'' +
                ", messageId='" + messageId + '\'' +
                ", messageArgs=" + messageArgs +
                ", oem=" + oem +
                '}';
    }
}
